typedef unsigned char Byte;
typedef unsigned int Word;

Byte Multiply(const Byte lhs, const Byte rhs)
{
	Word result = 0;
	for (unsigned bitIndex = 0; bitIndex < 8; bitIndex++)
	{
		if (rhs & (1 << (7-bitIndex) ) )
		{
			result ^= lhs;
		}
		if( result > 255)
			result ^= 0x11b;
		if(bitIndex < 7)
			result <<= 1;
	}
		return static_cast<Byte>(result);
}
#include <cstdio>
int main()
{
	printf("%x\n", Multiply(0x3, 0x3f));
}
